#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
using LL = long long;
const int MOD = 1000000007;

LL shu[MAXN];    // 数
char op[MAXN]; // 操作符号
LL p[MAXN];
LL d[MAXN];
LL m[MAXN];

int main() {
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= q; i++) {
    cin >> op[i];
    if (op[i] == '+') {
      cin >> p[i] >> d[i];
    } else {
      cin >> m[i];
    }
  }
  LL bei = 1;                      // 从后往前累乘倍数
  for (int i = q; i >= 1; i--) { // 从后往前循环
    if (op[i] == '*') { // 如果是乘，bei变成之前所有数的倍数
      (bei *= m[i]) %= MOD;
    } else { // 加就加上数乘以它往后的所有倍数
      (shu[p[i]] += d[i] * bei) %= MOD;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << shu[i] << " ";
  }
  return 0;
}